package com.hphs.threadlocal;

import com.hphs.info.PageInfo;

public class LocalPageInfoUtil {
    //线程共享对象
    private static ThreadLocal<PageInfo> localPageInfoThread= new ThreadLocal<>();

    //设置标签 set {k,v}
    public static void set(PageInfo pageInfo){
        localPageInfoThread.set(pageInfo);
    }

    //从线程上获取标签数据 但是 只是只读模式
    public static PageInfo get(){
        return localPageInfoThread.get();
    }
    //删除  不删除会导致内存溢出
    public static void remove(){
        localPageInfoThread.remove();
    }

}
